﻿using Model.ResultModel;
using SqlSugar;

namespace Model.EntityModel.Auth
{
    /// <summary>
    /// 系统菜单管理表
    ///</summary>
    [SugarTable("MENU_MASTER")]
    public class Menu
    {
        /// <summary>
        /// 自增主键ID 
        ///</summary>
        [SugarColumn(ColumnName = "ID", IsPrimaryKey = true)]
        public decimal Id { get; set; }
        // 建议添加Id字段用于映射
     
        /// <summary>
        /// 唯一的路由路径，用于前端路由匹配 
        ///</summary>
        [SugarColumn(ColumnName = "PATH")]
        public string Path { get; set; }
        /// <summary>
        /// 菜单显示名称 
        ///</summary>
        [SugarColumn(ColumnName = "NAME")]
        public string Name { get; set; }
        /// <summary>
        /// 对应Vue组件路径或懒加载函数 
        ///</summary>
        [SugarColumn(ColumnName = "COMPONENT")]
        public string? Component { get; set; }
        /// <summary>
        /// 跳转的目标路由路径 
        ///</summary>
        [SugarColumn(ColumnName = "REDIRECT")]
        public string Redirect { get; set; }
        /// <summary>
        /// 菜单图标CSS类名 
        ///</summary>
        [SugarColumn(ColumnName = "ICON")]
        public string Icon { get; set; }
        /// <summary>
        /// 菜单项标题文字 
        ///</summary>
        [SugarColumn(ColumnName = "TITLE")]
        public string Title { get; set; }
        /// <summary>
        /// 默认展开的子菜单路径 
        ///</summary>
        [SugarColumn(ColumnName = "ACTIVE_MENU")]
        public string ActiveMenu { get; set; }
        /// <summary>
        /// 外部超链接地址（非站内路由） 
        ///</summary>
        [SugarColumn(ColumnName = "IS_LINK")]
        public string IsLink { get; set; }
        /// <summary>
        /// 控制菜单是否在导航栏隐藏（布尔值） 
        ///</summary>
        [SugarColumn(ColumnName = "IS_HIDE")]
        public short? IsHide { get; set; }
        /// <summary>
        /// 是否启用全屏容器渲染（布尔值） 
        ///</summary>
        [SugarColumn(ColumnName = "IS_FULL")]
        public short? IsFull { get; set; }
        /// <summary>
        /// 是否将菜单固定在顶部导航栏（布尔值） 
        ///</summary>
        [SugarColumn(ColumnName = "IS_AFIX")]
        public short? IsAfix { get; set; }
        /// <summary>
        /// 是否启用Vue的keep-alive缓存（布尔值） 
        ///</summary>
        [SugarColumn(ColumnName = "IS_KEEP_ALIVE")]
        public short? IsKeepAlive { get; set; }
        /// <summary>
        /// 父级菜单ID，构建层级关系 
        ///</summary>
        [SugarColumn(ColumnName = "PARENT_ID")]
        public decimal? ParentId { get; set; }
        /// <summary>
        /// 菜单排序字段（新增）
        ///</summary>
        [SugarColumn(ColumnName = "SORT_ORDER")]
        public int SortOrder { get; set; } = 0; // 默认值为0
        /// <summary>
        /// 菜单类型标识[M=目录,C=菜单,B=按钮]
        ///</summary>
        [SugarColumn(ColumnName = "MENU_TYPE")]
        public string MenuType { get; set; }
        /// <summary>
        /// 状态标识：Y=激活，N=失效
        /// 默认值设为激活状态（'Y'）
        /// </summary>
        [SugarColumn(ColumnName = "IS_ACTIVE", DefaultValue = "Y")]
        public string IsActive { get; set; }

        /// <summary>
        /// 子关系（非数据库字段）
        ///</summary>
        [SugarColumn(IsIgnore = true)]
        public List<MenuResult> Children { get; set; } = new List<MenuResult>(); // 新增子节点集合
    }
}
